package com.zyx.mpdemo.model.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import com.zyx.mpdemo.model.enums.CourseStatusEnums;
import com.zyx.mpdemo.model.vo.CourseVO;
import lombok.Data;

/**
 * <p>t_course对应实体类
 *
 * @author Yaxi.Zhang
 * @since 2022/11/21 12:13
 */
@TableName(value ="t_course")
@Data
public class Course implements Serializable {

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 课程id
     */
    private Long courseId;

    /**
     * 课程名称
     */
    private String courseName;

    /**
     * 课程章节
     */
    private String chapter;

    /**
     * 课程序号数
     */
    private String sequence;

    /**
     * 课程小时数
     */
    private Integer courseHours;

    /**
     * 课程分钟数
     */
    private Integer courseMinutes;

    /**
     * 课程秒数
     */
    private Integer courseSeconds;

    /**
     * 课程状态
     */
    private CourseStatusEnums courseStatus;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    public CourseVO toCourseVO() {
        CourseVO courseVO = new CourseVO();
        courseVO.setId(this.id);
        courseVO.setCourseId(this.courseId);
        courseVO.setCourseName(this.courseName);
        courseVO.setChapter(this.chapter);
        courseVO.setSequence(this.sequence);
        courseVO.setCourseHours(this.courseHours);
        courseVO.setCourseMinutes(this.courseMinutes);
        courseVO.setCourseSeconds(this.courseSeconds);
        courseVO.setCourseStatus(this.courseStatus.getDesc());
        return courseVO;
    }

}